import request from "@/utils";

// 获取商家数据接口
export const getMerchantAPI = () => {
  return request({
    url: "/api/merchants",
    method: "get",
  });
};

// 添加商家数据接口
export const addMerchantAPI = ({
  trade_name,
  trade_address,
  linkman,
  tel,
  email,
}) => {
  return request({
    url: "/api/addMerchant",
    method: "post",
    data: {
      trade_name,
      trade_address,
      linkman,
      tel,
      email,
    },
  });
};

//修改商家数据接口
export const updateMerchantAPI = ({
  id,
  trade_name,
  trade_address,
  linkman,
  tel,
  email,
}) => {
  return request({
    url: "/api/updateMerchant",
    method: "post",
    data: {
      id,
      trade_name,
      trade_address,
      linkman,
      tel,
      email,
    },
  });
};

// 删除商家数据接口
export const delMerchantAPI = (id) => {
  return request({
    url: "/api/delMerchant/" + id,
    method: "get",
  });
};
